<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="animate.js"></script>
  <style>
    .box {
      width: 100px;
      height: 100px;
      background-color: #ccc;
      position: absolute;
      left: 0;
    }
  </style>
</head>

<body>
  <button class="btn">点击移动400</button>
  <button class="btn1">点击移动800</button>
  <div class="box">

  </div>
  <script>
    var btn = document.querySelector('.btn')
    var btn1 = document.querySelector('.btn1')
    var boxObj = document.querySelector('.box')
    btn.addEventListener('click', function () {
      animate(boxObj, 800, function () {
        btn.innerHTML = 'well-done'
      })
    })
    btn1.addEventListener('click', function () {
      animate(boxObj, 400, function () {
        btn1.innerHTML = '我回啦了'
      })
    })
  </script>
</body>

</html>